const MiniCssExtractPlugin = require('mini-css-extract-plugin');

const {merge} = require('webpack-merge');
const base = require('./webpack.base');
const webpack = require('webpack');

module.exports = merge(base, {
    mode: 'production',
    devServer: {
        disableHostCheck: true,
        contentBase: './',
        hot: true,
        inline: true,
        port: 8081,
    },
    module: {
        rules: [{
                test: /\.scss$/,
                use: [{
                        loader: MiniCssExtractPlugin.loader,
                    },
                    'css-loader',
                    'postcss-loader',
                    'sass-loader'
                ]
            },
            {
                test: /\.css$/,
                use: [{
                        loader: MiniCssExtractPlugin.loader,
                    },
                    'css-loader',
                    'postcss-loader',
                ],
            },
        ]
    },
    plugins: [
        new MiniCssExtractPlugin({
            filename: '[name]/index.[hash].css',
            chunkFilename: "[id].css",
            minimize: true,
        })
    ]
})